//package com.ball.service.impl;
//
//import com.alibaba.fastjson.JSONObject;
//import com.ball.dao.GameMapper;
//import com.ball.entity.Game;
//import com.ball.service.GameService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//@Service
//public class GameServiceImpl implements GameService {
//    @Autowired
//    GameMapper gameMapper;
//    @Override
//    public String add(JSONObject json) {
//        int id=Integer.parseInt(json.getString("id"));
//        String homeTeam = json.getString("homeTeam");
//        String awayTeam=json.getString("awayTeam");
//        String homeTeamOdds=json.getString("homeTeamOdds");
//        String awayTeamOdds=json.getString("awayTeamOdds");
//        String walletName=json.getString("walletName");
//        String walletAddress=json.getString("walletAddress");
//        String money=json.getString("money");
//        Game game=new Game(id,homeTeam,awayTeam,homeTeamOdds,awayTeamOdds,walletName,walletAddress,money);
//        gameMapper.add(game);
//        return "add game: "+game.toString();
//      }
//
//    @Override
//    public String update(JSONObject json) {
//        int id=Integer.parseInt(json.getString("id"));
//        String homeTeam = json.getString("homeTeam");
//        String awayTeam=json.getString("awayTeam");
//        String homeTeamOdds=json.getString("homeTeamOdds");
//        String awayTeamOdds=json.getString("awayTeamOdds");
//        String walletName=json.getString("walletName");
//        String walletAddress=json.getString("walletAddress");
//        String money=json.getString("money");
//        Game game=new Game(id,homeTeam,awayTeam,homeTeamOdds,awayTeamOdds,walletName,walletAddress,money);
//        gameMapper.update(game);
//        return "update game: "+game.toString();
//
//    }
//
//    @Override
//    public String deleteGameById(JSONObject json) {
//        int id=Integer.parseInt(json.getString("id"));
//        gameMapper.deleteGameById(id);
//        return "deleteGameById: "+id;
//    }
//
//    @Override
//    public Game queryGameById(JSONObject json) {
//        int id=Integer.parseInt(json.getString("id"));
//        return gameMapper.queryGameById(id);
//    }
//
//    @Override
//    public List<Game> queryGameList(JSONObject json) {
//        return  gameMapper.queryGameList();
//    }
//
//    @Override
//    public List<Game> queryGameByGameName(JSONObject json) {
//        String teamName = json.getString("teamName");
//        return gameMapper.queryGameByGameName(teamName);
//    }
//}
